home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10269 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: lrz-muenchen.de!news
  2. From: watzka@stat.uni-muenchen.de (Kurt Watzka)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: String Question
  5. Date: 16 Mar 1996 11:38:43 GMT
  6. Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
  7. Distribution: world
  8. Message-ID: <4ie983$3v0@sparcserver.lrz-muenchen.de>
  9. References: <DoBt0E.4A9@freenet.carleton.ca>
  10. NNTP-Posting-Host: sun2.lrz-muenchen.de
  11.  
  12. aq436@FreeNet.Carleton.CA (Jerry Boyd) writes:
  13.  
  14. >How would I write a function to remove a specified
  15. >number of characters from a string and store it in an array.
  16.  
  17. If you want to take part in the annual "reinvent the wheel" contest,
  18. by copying a specified ...
  19.  
  20. Otherwise, use strncpy(), but don't forget to hav a look at the
  21. documentation for that function from the standard C library
  22. first.
  23.  
  24. >For instance, extracting three characters from a string, starting
  25. >from the 5th character.
  26.  
  27.     strncpy(dest, src + 5, 3);
  28.  
  29. Kurt
  30. --
  31. | Kurt Watzka                             Phone : +49-89-2180-6254
  32. | watzka@stat.uni-muenchen.de
  33. | ua302aa@sunmail.lrz-muenchen.de
  34.